import { IPSDataEntity } from '../ipsdata-entity';
import { IPSDEDEPrintLogic } from './ipsdedeprint-logic';
import { IPSDELogic } from './ipsdelogic';
import { IPSDELogicParam } from './ipsdelogic-param';
import { PSDELogicNodeImpl } from './psdelogic-node-impl';
import { IPSDEPrint } from '../print/ipsdeprint';

export class PSDEDEPrintLogicImpl extends PSDELogicNodeImpl implements IPSDEDEPrintLogic {
  protected dstpsdelogicparam: IPSDELogicParam | null = null;

  getDstPSDELogicParam(): IPSDELogicParam | null {
    if (this.dstpsdelogicparam != null) return this.dstpsdelogicparam;
    const value = this.M.getDstPSDELogicParam;
    if (value == null) {
      return null;
    }
    const ipsdelogic = this.getParentPSModelObject('dataentity.logic.IPSDELogic') as IPSDELogic;
    if (ipsdelogic != null) {
      this.dstpsdelogicparam = ipsdelogic.findPSDELogicParam(value);
    }
    return this.dstpsdelogicparam;
  }

  get dstPSDELogicParam(): IPSDELogicParam | null {
    return this.getDstPSDELogicParam();
  }

  getDstPSDELogicParamMust(): IPSDELogicParam {
    const value = this.getDstPSDELogicParam();
    if (value == null) {
      throw new Error('未指定目标逻辑参数对象');
    }
    return value;
  }

  protected dstpsdeprint: IPSDEPrint | null = null;

  getDstPSDEPrint(): IPSDEPrint | null {
    if (this.dstpsdeprint != null) return this.dstpsdeprint;
    const value = this.M.getDstPSDEPrint;
    if (value == null) {
      return null;
    }
    this.dstpsdeprint = this.getDstPSDataEntityMust().findPSDEPrint(value);
    return this.dstpsdeprint;
  }

  get dstPSDEPrint(): IPSDEPrint | null {
    return this.getDstPSDEPrint();
  }

  getDstPSDEPrintMust(): IPSDEPrint {
    const value = this.getDstPSDEPrint();
    if (value == null) {
      throw new Error('未指定目标实体打印对象');
    }
    return value;
  }

  protected dstpsdataentity: IPSDataEntity | null = null;

  getDstPSDataEntity(): IPSDataEntity | null {
    if (this.dstpsdataentity != null) return this.dstpsdataentity;
    const value = this.M.getDstPSDataEntity;
    if (value == null) {
      return null;
    }
    this.dstpsdataentity = this.getPSModel4('dataentity.IPSDataEntity', value, 'getDstPSDataEntity') as IPSDataEntity;
    return this.dstpsdataentity;
  }

  get dstPSDataEntity(): IPSDataEntity | null {
    return this.getDstPSDataEntity();
  }

  getDstPSDataEntityMust(): IPSDataEntity {
    const value = this.getDstPSDataEntity();
    if (value == null) {
      throw new Error('未指定目标实体对象');
    }
    return value;
  }

  protected ospsdelogicparam: IPSDELogicParam | null = null;

  getOSPSDELogicParam(): IPSDELogicParam | null {
    if (this.ospsdelogicparam != null) return this.ospsdelogicparam;
    const value = this.M.getOSPSDELogicParam;
    if (value == null) {
      return null;
    }
    const ipsdelogic = this.getParentPSModelObject('dataentity.logic.IPSDELogic') as IPSDELogic;
    if (ipsdelogic != null) {
      this.ospsdelogicparam = ipsdelogic.findPSDELogicParam(value);
    }
    return this.ospsdelogicparam;
  }

  get oSPSDELogicParam(): IPSDELogicParam | null {
    return this.getOSPSDELogicParam();
  }

  getOSPSDELogicParamMust(): IPSDELogicParam {
    const value = this.getOSPSDELogicParam();
    if (value == null) {
      throw new Error('未指定输出流逻辑参数对象');
    }
    return value;
  }

  get cls(): string {
    return 'PSDEDEPrintLogicImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'dataentity.logic.IPSDEDEPrintLogic') return true;
    return super.instanceof(cls);
  }
}
